Re: Race conditions, mkstemp (fwd)

Jonathan M. Bresler (jmb@kryten.Atinc.COM)
Sun, 11 Dec 1994 12:20:29 -0500 (EST)

On Sun, 11 Dec 1994, Casper Dik wrote:

> 
> >
> >	here is the source for mkstemp from csrg.  note the filesystem 
> >must support exclusive file locking atomic to the open() for this to be 
> >helpful.  as is written in the mkstemp() man page.
> >
> >	why wasnt O_TRUNC included.  that would hammer both soft and hard links
> 
> 
> Because it serves no useful purpose.  A file created with O_EXCL|O_CREAT
> will have 0 lenght.  If the file needs to be truncated (O_TRUNC) it
> already exists, but i that case the open w/ O_CREATE|O_EXCL would fail.
> 
> O_CREATE|O_TRUNC|O_EXCL makes no sense.
> 
> Casper
> 


	i gotta learn to read the man pages more carefully.  there it si 
at the bottom, in plain view:

	[EEXIST]  O_CREAT and O_EXCL were specified and the file exists.

	sorry for wasting everyone's time.
jmb

Jonathan M. Bresler  jmb@kryten.atinc.com	| Analysis & Technology, Inc.  
						| 2341 Jeff Davis Hwy
play go.					| Arlington, VA 22202
ride bike. hack FreeBSD.--ah the good life	| 703-418-2800 x346